Purpose
The string indexOf task finds the position (index) of a specific character or group of characters within a given string. By default, characters in a string are indexed from left to right. The indexOf task is also case-sensitive. In conjunction with other workflow tasks, this task is very useful when you need to find the first instance (or all instances) of when a specific character occurs.
Potential Use Case
Let's say you are attempting to extract email domains from user email addresses, and you need to isolate the exact position of the '@' symbol in the email address. In this scenario, using indexOf will allow you to obtain the information you need.
Properties
| Incoming | Type | Description | 
|---|---|---|
| str | String | Required. The string that contains the character value to search. | 
| searchValue | String | Required. The character to search for within the strproperty. | 
| fromIndex | Number | Optional. The position (index) in the string to start the search. Numbering starts (and defaults) at position '0' (the beginning of the strvalue). | 
| Outgoing | Type | Description | 
|---|---|---|
| index | Number | The index position in strwhere thesearchValuefirst occurs. If thesearchValuecannot be found in the string then the function returns -1. | 
Examples
Example 1
In this IAP example:
- The - strvariable has been statically set as- abcabcdabcde.
- The - searchValuevariable is- abcd.
- The - fromIndexis set to- 0, indicating the search should start at the beginning of the line. Remember, numbering starts at zero.
- The output - indexwill be- 3, which represents the first instance of where "abcd" can be found in the- strvariable (at character position 3). 
Example 2
In this IAP example:
- The - strvariable has been statically set as- sales@itential.com.
- The - searchValuevariable has been statically set as- @.
- The - fromIndexis set to- 0, indicating the search should start at the beginning of the line. Remember, numbering starts at zero.
- The output - indexwill be- 5, because the first instance of the value- @occurs at character position 5 in the- strvariable.